
$("#js_upFile").uploadView({
    uploadBox: '.js_uploadBox',//设置上传框容器
    showBox : '.js_showBox',//设置显示预览图片的容器
    width : 75, //预览图片的宽度，单位px
    height : 60, //预览图片的高度，单位px
    allowType: ["gif", "jpeg", "jpg", "bmp", "png"], //允许上传图片的类型
    maxSize :20, //允许上传图片的最大尺寸，单位M
    success:function(e){
        $(".btn-upload").hide();
        $(".js_uploadBox").append('<div onclick="deleteInput(0)" class="am-u-sm-3" id="div0" style="float:left"><div class="btn-upload"><a href="javascript:void(0);"><i class="am-icon-picture-o am-icon-md"></i><span class="js_uploadText" style="font-size:24px"></span></a><input class="js_upFile"id="js_upFile1" type="file" name="cover[]"></div><div class="js_showBox1" ></div></div>');
        initupbtn(1);
        $(".imgInfo").show();
    }
});
function initupbtn(id){
    $("#js_upFile"+id).uploadView({
        uploadBox: '.js_uploadBox',//设置上传框容器
        showBox : '.js_showBox'+id,//设置显示预览图片的容器
        width : 75, //预览图片的宽度，单位px
        height : 60, //预览图片的高度，单位px
        allowType: ["gif", "jpeg", "jpg", "bmp", "png"], //允许上传图片的类型
        maxSize :20, //允许上传图片的最大尺寸，单位M
        success:function(e){
            $(".btn-upload").hide();
            $(".js_uploadBox").append('<div onclick="deleteInput('+id+')" class="am-u-sm-3" id="div'+id+'" style="float:left"><div class="btn-upload"><a href="javascript:void(0);"><i class="am-icon-picture-o am-icon-md"></i><span class="js_uploadText" style="font-size:24px"></span></a><input  class="js_upFile'+(id+1)+'"type="file" id="js_upFile'+(id+1)+'" name="cover[]">   </div><div  id="js_showBox'+(id+1)+'"  class="js_showBox'+(id+1)+'" ></div></div>');
            initupbtn(id+1);
            $(".imgInfo").show();
        }
    });
}


function  deleteInput(str){
    // $('#' + id).remove();

    console.log($("#div"+str).parent().find("div img").length);
    if($("#div"+str).find("div img").length > 0) {
        if($("#div"+str).parent().find("div img").length == 1) {
            $(".imgInfo").hide();
        }
        $("#div"+str).remove();

    }

}
